#!/bin/bash

# Check what SU program conflicts with instaled program
# and if they access the CWPROOT variable

ALL_SU_PROGRAMS=" \
                a2b                  \
                a2i                  \
                argv                 \
                b2a                  \
                bhedtopar            \
                cellauto             \
                copyright            \
                cpall                \
                cpftrend             \
                cshot1               \
                cshot2               \
                cshotplot            \
                ctrlstrip            \
                cwell                \
                cwpfind              \
                cxzco                \
                cxzcs                \
                cz1                  \
                cz1in                \
                dctcomp              \
                dctuncomp            \
                dirtree              \
                downfort             \
                dt1tosu              \
                dzdv                 \
                elacheck             \
                elamodel             \
                elaps                \
                elaray               \
                elasyn               \
                elatriuni            \
                entropy              \
                farith               \
                fcat                 \
                fftlab               \
                filetype             \
                float2ibm            \
                ftnstrip             \
                ftnunstrip           \
                gbbeam               \
                gendocs              \
                Grep                 \
                grm                  \
                h2b                  \
                hti2stiff            \
                hudson               \
                ibm2float            \
                isatty               \
                kaperture            \
                las2su               \
                lcmap                \
                linrort              \
                lookpar              \
                lorenz               \
                lprop                \
                makevel              \
                maxdiff              \
                maxints              \
                merge2               \
                merge2v              \
                merge4               \
                mkparfile            \
                mrafxzwt             \
                newcase              \
                normray              \
                overwrite            \
                pause                \
                pdfhistogram         \
                percent              \
                precedence           \
                prplot               \
                psbbox               \
                pscontour            \
                pscube               \
                pscubecontour        \
                psepsi               \
                psgraph              \
                psimage              \
                pslabel              \
                psmanager            \
                psmerge              \
                psmovie              \
                pstopdfcymk          \
                pswigb               \
                pswigp               \
                randvel3d            \
                raydata              \
                rayt2d               \
                rayt2dan             \
                rcpall               \
                rcslocks             \
                recast               \
                recip                \
                refRealAziHTI        \
                refRealVTI           \
                regrid3              \
                replace              \
                resamp               \
                rmaxdiff             \
                scmap                \
                segbread             \
                segdread             \
                segyclean            \
                segyhdrmod           \
                segyhdrs             \
                segyread             \
                segywrite            \
                setbhed              \
                smooth2              \
                smooth3d             \
                smoothint2           \
                spsplot              \
                stiff2vel            \
                striptotxt           \
                su3dchart            \
                suabshw              \
                suacor               \
                suacorfrac           \
                suaddevent           \
                suaddhead            \
                suaddnoise           \
                suaddstatics         \
                suagc                \
                sualford             \
                suamp                \
                suascii              \
                suattributes         \
                suazimuth            \
                subackus             \
                subackush            \
                suband               \
                subfilt              \
                subset               \
                succfilt             \
                succwt               \
                sucddecon            \
                sucdpbin             \
                sucentsamp           \
                sucepstrum           \
                suchart              \
                suchw                \
                sucliphead           \
                sucmp                \
                sucommand            \
                suconv               \
                sucountkey           \
                sucvs4fowler         \
                sucwt                \
                sudatumfd            \
                sudatumk2dr          \
                sudatumk2ds          \
                sudiff               \
                sudipdivcor          \
                sudipfilt            \
                sudivcor             \
                sudivstack           \
                sudmofk              \
                sudmofkcw            \
                sudmotivz            \
                sudmotx              \
                sudmovz              \
                sudoc                \
                sudumptrace          \
                suea2df              \
                suedit               \
                sueipofi             \
                suenv                \
                sufbpickw            \
                sufctanismod         \
                sufdmod1             \
                sufdmod2             \
                sufdmod2_pml         \
                sufft                \
                sufilter             \
                sufind               \
                sufind2              \
                suflip               \
                sufnzero             \
                sufrac               \
                sufwatrim            \
                sufwmix              \
                sufxdecon            \
                sugabor              \
                sugain               \
                sugassmann           \
                sugausstaper         \
                sugazmig             \
                sugendocs            \
                suget                \
                sugetgthr            \
                sugethw              \
                sugoupillaud         \
                sugoupillaudpo       \
                sugprfb              \
                suharlan             \
                suhelp               \
                suhilb               \
                suhrot               \
                suhtmath             \
                suifft               \
                suilog               \
                suimp2d              \
                suimp3d              \
                suimpedance          \
                suinterp             \
                suinterpfowler       \
                suintvel             \
                suinvvxzco           \
                suinvzco3d           \
                sujitter             \
                suk1k2filter         \
                sukdmig2d            \
                sukdmig3d            \
                sukdsyn2d            \
                sukeycount           \
                sukeyword            \
                sukfrac              \
                sukill               \
                suktmig2d            \
                sulcthw              \
                sulfaf               \
                sulhead              \
                sulog                \
                sulprime             \
                sultt                \
                sumax                \
                sumean               \
                sumedian             \
                sumigfd              \
                sumigffd             \
                sumiggbzo            \
                sumiggbzoan          \
                sumigprefd           \
                sumigpreffd          \
                sumigprepspi         \
                sumigpresp           \
                sumigps              \
                sumigpspi            \
                sumigpsti            \
                sumigsplit           \
                sumigtk              \
                sumigtopo2d          \
                sumix                \
                sumixgathers         \
                sumute               \
                suname               \
                sunan                \
                sunhmospike          \
                sunmo                \
                sunormalize          \
                sunull               \
                suocext              \
                suoldtonew           \
                suop                 \
                suop2                \
                supack1              \
                supack2              \
                supaste              \
                supef                \
                supermute            \
                supgc                \
                suphase              \
                suphasevel           \
                suphidecon           \
                supickamp            \
                suplane              \
                supofilt             \
                supolar              \
                suprod               \
                supscontour          \
                supscube             \
                supscubecontour      \
                supsgraph            \
                supsimage            \
                supsmax              \
                supsmovie            \
                supswigb             \
                supswigp             \
                suptdiff             \
                suptprod             \
                suptquo              \
                suptsum              \
                suput                \
                suputgthr            \
                supws                \
                suquantile           \
                suquo                \
                suradon              \
                suramp               \
                surandspike          \
                surandstat           \
                surange              \
                surecip              \
                sureduce             \
                surefcon             \
                sureflpsvsh          \
                surelan              \
                surelanan            \
                suresamp             \
                suresstat            \
                susehw               \
                sushape              \
                sushift              \
                sushw                \
                suslowft             \
                suslowift            \
                susmgauss2           \
                susort               \
                susorty              \
                suspecfk             \
                suspecfx             \
                suspeck1k2           \
                suspike              \
                susplit              \
                sustack              \
                sustatic             \
                sustaticrrs          \
                sustkvel             \
                sustolt              \
                sustrip              \
                susum                \
                suswapbytes          \
                susyncz              \
                susynlv              \
                susynlvcw            \
                susynlvfti           \
                susynvxz             \
                susynvxzcs           \
                sutaper              \
                sutaup               \
                sutetraray           \
                sutifowler           \
                sutihaledmo          \
                sutivel              \
                sutrcount            \
                sutsq                \
                suttoz               \
                sutvband             \
                sutxtaper            \
                suunpack1            \
                suunpack2            \
                suutm                \
                suvcat               \
                suvel2df             \
                suvelan              \
                suvelan_nccs         \
                suvelan_nsel         \
                suvelan_uccs         \
                suvelan_usel         \
                suvibro              \
                suvlength            \
                suwaveform           \
                suweight             \
                suwellrf             \
                suwfft               \
                suwind               \
                suwindpoly           \
                suxcontour           \
                suxcor               \
                suxedit              \
                suxgraph             \
                suximage             \
                suxmax               \
                suxmovie             \
                suxpicker            \
                suxwigb              \
                suzero               \
                suztot               \
                swapbytes            \
                sxplot               \
                t                    \
                tetramod             \
                this_year            \
                thom2hti             \
                thom2stiff           \
                time_now             \
                todays_date          \
                transp               \
                transp3d             \
                tri2uni              \
                trimodel             \
                trip                 \
                triray               \
                triseis              \
                triso                \
                trisoplot            \
                triview              \
                tvnmoqc              \
                unglitch             \
                uni2tri              \
                unif2                \
                unif2aniso           \
                unisam               \
                unisam2              \
                updatedoc            \
                updatedocall         \
                updatehead           \
                upfort               \
                usernames            \
                utmconv              \
                varlist              \
                vel2stiff            \
                velconv              \
                velpert              \
                velpertan            \
                verhulst             \
                viewer3              \
                vtlvz                \
                weekday              \
                why                  \
                wkbj                 \
                wpc1comp2            \
                wpc1uncomp2          \
                wpccompress          \
                wpcuncompress        \
                wptcomp              \
                wptuncomp            \
                wtcomp               \
                wtuncomp             \
                xcontour             \
                xgraph               \
                ximage               \
                xmovie               \
                xpicker              \
                xrects               \
                xwigb                \
                xy2z                 \
                z2xyz                \
                zap                  \
		"

ii=0

for P in $ALL_SU_PROGRAMS ; do

  let ii=ii+1

  echo "$ii $P"

  F=`apt-file find "bin/$P"`

  if [ ! "x$F" == "x" ] ; then 
    echo -e "$P\n$F\n" > "$P.txt"
  fi

done

